<template>
  <div class="transaction-service-list bg-c-fff right-height mb70">
    <p class="bread rel">
      <a href="javascript:void(0);" class="font-s-16">法律服务监控员-客户投诉管理</a>
    </p>
    <div class="content">
      <div class="seach">
        <input type="text" name="" class="input-css" v-model="keyWord" placeholder="客户信息/服务律师">
        <button class="xl-btn-css blue-button vb" @click="getCompData(1)">搜索</button>
      </div>
      <table width="100%" class="auto">
        <tr>
          <th>提交时间</th>
          <th>订单编号</th>
          <th>客户信息</th>
          <th>联系方式</th>
          <th>服务律师</th>
          <th>联系方式</th>
          <th>投诉订单</th>
          <th>投诉信息</th>
        </tr>
        <tr v-for="(item,index) in compList">
          <td>{{item.createTime}}</td>
          <td>{{item.id}}</td>
          <td>{{item.userInfo | nameFilter}}</td>
          <td>{{item.userInfo | numFilter}}</td>
          <td>{{item.lawyerInfo | nameFilter}}</td>
          <td>{{item.lawyerInfo | numFilter}}</td>
          <td>
            <button class="blue-button small-btn-css" @click="onDetailClick(item.orderNum)">查看订单</button>
          </td>
          <td>
            <button class="blue-button small-btn-css" @click="onMsgClick(index)">查看详情</button>
          </td>
        </tr>
      </table>
      <div class="fix foot-box">
        <div class="no-data-tip" v-show="compList.length===0">暂无相关数据</div>
        <pagination :index="pageIndex" :total="pageTotal" v-show="this.compList!=0" @pagechange="onPageChange"></pagination>
      </div>
    </div>
    <vodal :show="msgShow" animation="zoom" :width="350" :height="217" @hide="msgShow=false">
      <div class="vodal-main">
        <h4>客户投诉信息</h4>
        <div class="con">
          <textarea>{{msgCon}}</textarea>
        </div>
      </div>
    </vodal>
  </div>
</template>
<script type="text/javascript">
import Pagination from '../components/Pagination'
export default {
  components: {
    Pagination
  },
  data() {
    return {
      msgShow: false,
      pageIndex: 1,
      pageTotal: 0,
      compList: [],
      msgCon: '',
      keyWord: ''
    }
  },
  mounted() {
    this.onPageChange(1)
  },
  methods: {
    onPageChange(n) {
      this.getCompData(n)
    },
    getCompData(n) {
      this.$http.get('/message/query/complain/list', {
        params: {
          search: this.keyWord
        }
      }).then(data => {
        if (data.data.httpCode === 200) {
          this.pageIndex = n
          this.pageTotal = Math.ceil(data.data.total / 10)
          this.compList = data.data.rows
          console.log(this.compList)
        } else {
          console.log(data.data.msg)
          this.$toasted.show(data.data.msg)
        }
      }).catch(err => {
        console.log(err)
      })
    },
    onDetailClick(id) {
      this.$router.push('/lms-order-monitor?id=' + id)
    },
    onMsgClick(index) {
      this.msgCon = this.compList[index].msgContent
      this.msgShow = true
    }
  },
  filters: {
    nameFilter(n) {
      return n.split(',')[0]
    },
    numFilter(n) {
      return n.split(',')[1]
    }
  }
}

</script>
<style type="text/css" scoped>
.bread {
  padding-left: 20px;
  border-bottom: 1px solid #ddd;
}

.bread a {
  line-height: 45px;
}

.bread button {
  right: 10px;
  top: 8px;
}

.content {
  padding: 0 30px 30px;
}

.content .seach input,
.content .seach button {
  height: 35px;
  line-height: 35px;
}

.content .seach {
  padding: 20px 0px;
}

.content .seach button {
  margin-left: -5px;
}

.foot-box {
  padding: 35px 0px 0px 0px;
}

.vodal-main textarea {
  width: 310px;
  height: 120px;
  padding: 10px;
}

</style>
